<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>axios的GET方式的传值</title>
    <script src="js/vue.js"></script>
    <script src="js/axios.min.js"></script>
</head>
<body>
    <div id="app">
         <input type="text" v-model="empno" placeholder="请输入编号">
         <button @click="getEmpById">查询</button>
         <div>
             {{emp.empno}}<br>
             {{emp.ename}}<br>
         </div>
    </div>
</body>
</html>
<script>
    var vm=new Vue({
        el:'#app',
        data:{
            empno:'',
            url:'http://localhost:8080/getEmpById',
            emp:{}
        },
        methods: {
            getEmpById(){
              axios({
                  url:this.url,
                  method:'GET',
                  params:{
                      empno:this.empno
                  }
              }).then(res=>{
                  console.log(res);
              });
            }
        },
    });
</script>